package com.lei.springbootpractice3.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration // 声明这是一个配置类
public class SecurityConfig {

    @Bean // 将这个方法的返回值作为一个 Bean 放入 Spring 容器中
    public PasswordEncoder passwordEncoder() {
        // 返回 BCrypt 加密器
        return new BCryptPasswordEncoder();
    }
}
